//
// Created by afly on 20-12-28.
// Mail: a_fly0505@163.com
// QQ: 785230837 WX: afly003
// Company: juefx
//

#ifndef __THREAD_MANAGER_H__
#define __THREAD_MANAGER_H__

#include <map>
#include <string>
#include <memory>

#include "utils/single_ton.hpp"

namespace qsm {

    class ThreadPool;

    using ThreadPoolMap = std::map <std::string, std::shared_ptr<ThreadPool>>;
    using ThreadPoolPtr = std::shared_ptr <ThreadPool>;

    class ThreadManager : public Singleton<ThreadManager> {
    public:
        virtual ~ThreadManager();

        int Init();

        ThreadPoolPtr GetThreadPool(const char *name);

        ThreadPoolPtr GetThreadPoolOrCreate(const char *name);

        void RemoveThreadPool(const char *name);

    private:
        ThreadManager();

    private:
        ThreadPoolMap m_ThreadPools;
    };
}
#endif  //__THREAD_MANAGER_H__
